#pragma once

//#include "any.h"

namespace sol9
{

	//// Declare BaseClass
	//#define __declareBaseClass(base) \
	//public: \
	//	static const CRTTI m_sRTTI; \
	//	virtual const CRTTI* getRTTI() const \
	//	{ \
	//		return &m_sRTTI; \
	//	} \
	//	static bool isDerivedFrom(const CRTTI* pRTTI, const base* pBase) \
	//	{ \
	//		if (!pBase) \
	//		{ \
	//			return false; \
	//		} \
	//		return pBase->isDerivedFrom(pRTTI); \
	//	} \
	//	bool isDerivedFrom(const CRTTI* pRTTI) const \
	//	{ \
	//		const CRTTI* pCurr = getRTTI(); \
	//		while (pCurr) \
	//		{ \
	//			if (pCurr == pRTTI) \
	//			{ \
	//				return true; \
	//			} \
	//			pCurr = pCurr->getParent(); \
	//		} \
	//		return false; \
	//	} \
	//	static base* fastCast(const CRTTI* pRTTI, const base* pBase) \
	//	{ \
	//		if (!pBase) \
	//		{ \
	//			return NULL; \
	//		} \
	//		return pBase->fastCast(pRTTI); \
	//	} \
	//	base* fastCast(const CRTTI* pRTTI) const \
	//	{ \
	//		return isDerivedFrom(pRTTI) ? (base*)this : NULL; \
	//	}

	// Declare BaseClass
	#define __declareBaseClass(base) \
	public: \
		static const CRTTI m_sRTTI; \
		virtual const CRTTI* getRTTI() const \
		{ \
		return &m_sRTTI; \
		} \

	// Declare DerivedClass
	#define __declareClass(derived) \
	public: \
		static const CRTTI m_sRTTI; \
		virtual const CRTTI* getRTTI() const \
		{ \
			return &m_sRTTI; \
		} \

	// Implement BaseClass
	#define __implementBaseClass(base) \
		const CRTTI base::m_sRTTI(_T(#base), NULL)

	// Implement DerivedClss
	#define __implementClass(derived, base) \
		const CRTTI derived::m_sRTTI(_T(#derived), &base::m_sRTTI)

	// isDrivedFrom(derived, base)
	#define isDerived(derivedClass, baseClass) \
		derivedClass::m_sRTTI.isDerivedFrom(baseClass::m_sRTTI)

	//// fast_cast<derived*>(base)
	//#define fast_cast(derivedClass, baseObject) \
	//	(derivedClass*)derivedClass::fastCast(&derivedClass::m_sRTTI, baseObject)

	//template <typename derived>
	//derived _fast_cast(any baseObject)
	//{
	//	fast_cast(derived, baseObject);
	//};

} // namespace sol9